#include <cstdio>
#include <cstring>

char a[ 51 ][ 51 ];

int main( )
{
    int n, i, j, k, cnt, p;
    bool visit[ 51 ][ 51 ], flag;
    while ( scanf("%d", &n) && n )
    {
        for ( i = 0; i < n; i++ )
            scanf("%s", a[ i ]);
        cnt = 0;
        memset( visit, 0, sizeof( visit ) );
        for ( i = 0; i < n; i++ )
            for ( j = 0; j < n; j++ )
                if ( !visit[ i ][ j ] && i && j && i != n - 1 && j != n - 1 && a[ i ][ j ] == '#'
                    && a[ i + 1 ][ j ] == '#' && a[ i - 1 ][ j ] == '#' && a[ i ][ j + 1 ] == '#' && a[ i ][ j - 1 ] == '#' )
                {
                    visit[ i ][ j ] = 1;
                    flag = 1;
                    for ( k = i - 1; k >= 0; k-- )
                    {
                        if ( a[ k ][ j ] == 'o' ) break;
                        if ( visit[ k ][ j ] || a[ k ][ j - 1 ] == '#' || a[ k ][ j + 1 ] == '#' )
                        {
                            flag = 0;
                            break;
                        }
                        visit[ k ][ j ] = 1;
                    }
                    if ( !flag ) continue;
                    p = i - k;
                    for ( k = i + 1; k < n; k++ )
                    {
                        if ( a[ k ][ j ] == 'o' ) break;
                        if ( visit[ k ][ j ] || a[ k ][ j - 1 ] == '#' || a[ k ][ j + 1 ] == '#' )
                        {
                            flag = 0;
                            break;
                        }
                        visit[ k ][ j ] = 1;
                    }
                    if ( !flag || k - i != p ) continue;
                    for ( k = j - 1; k >= 0; k-- )
                    {
                        if ( a[ i ][ k ] == 'o' ) break;
                        if ( visit[ i ][ k ] || a[ i - 1 ][ k ] == '#' || a[ i + 1 ][ k ] == '#' )
                        {
                            flag = 0;
                            break;
                        }
                        visit[ i ][ k ] = 1;
                    }
                    if ( !flag || j - k != p ) continue;
                    for ( k = j + 1; k < n; k++ )
                    {
                        if ( a[ i ][ k ] == 'o' ) break;
                        if ( visit[ i ][ k ] || a[ i - 1 ][ k ] == '#' || a[ i + 1 ][ k ] == '#' )
                        {
                            flag = 0;
                            break;
                        }
                        visit[ i ][ k ] = 1;
                    }
                    if ( !flag || k - j != p ) continue;
                    cnt++;
                }
        printf("%d\n", cnt);
    }
    return 0;
}
